package com.sbj.controller;

import com.sbj.dto.req.ExpendReq;
import com.sbj.dto.res.ExpendRes;
import com.sbj.dto.res.IncomeRes;
import com.sbj.service.IExpendService;
import com.sbj.service.IIncomeService;
import com.zmh.framework.util.Result;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/11 22:04
 * 支出
 */
@RestController
@RequestMapping(value = "/expend")
@AllArgsConstructor
public class MemberExpendController {

    private final IExpendService expendService;

    /*
    支出明细
     */
    @PostMapping(value = "/memberExpendList")
    public Result<List<ExpendRes>> memberExpendList(@RequestBody ExpendReq req){

        return Result.successResult(expendService.lists(req));
    }

    private final IIncomeService incomeService;

    /**
     * 收入明细
     * @param req
     * @return
     */
    @PostMapping(value = "/memberIncomeList")
    public Result<List<IncomeRes>> memberIncomeList(@RequestBody ExpendReq req){

        return Result.successResult(incomeService.lists(req));
    }
}
